package com.demo.des;

import org.ad.crypto.DESPlus;

import android.app.Activity;
import android.os.Bundle;

/**
 * 加密之后是可识别的字符串
 * iWei
 * @date 2013-8-28
 */
public class DESMainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		//待加密内容 
		String str = "list?cityid=1";

		// 密码，长度要是8的倍数 
		String pwdKey = "abcdefaa"; 
		
		try {
			DESPlus des = new DESPlus(pwdKey);// 自定义密钥
			System.out.println("加密前的字符：" + str);
			System.out.println("加密后的字符：" + des.encrypt(str));
			System.out.println("解密后的字符：" + des.decrypt(des.encrypt(str)));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
